Rails.application.routes.draw do
  get "test/index"
  # 定义了新闻列表页面的路由
  get "news/index"

  # 定义了回调处理页面的路由
  get "feedbacks" => "feedbacks#index"

  # 定义了问题列表页面的路由
  get "questions" => "questions#index"

  # 定义了工具页面的路由
  get "tools" => "tools#index"

  # 定义了比较页面的路由
  get "cmps" => "cmps#index"

  # 定义了项目列表页面的路由
  get "projects" => "projects#index"

  # 定义了团队页面的路由
  get "members" => "members#index"

  # 定义了登录页面的路由
  get "login" => "sessions#new"

  # 定义了注销页面的路由
  get "logout" => "sessions#destroy"

  # 定义了注册页面的路由
  get "register" => "users#new"

  # 定义了用户个人资料页面的路由
  get "profile" =>"users#show"

  # 根据Rails路由DSL定义应用路由，详见https://guides.rubyonrails.org/routing.html

  # 在/up路径上揭示健康状态，如果应用启动时没有异常，则返回200，否则返回500
  # 可以由负载均衡器和 uptime 监控器使用，以验证应用是否处于活动状态
  get "up" => "rails/health#show", as: :rails_health_check

  # 从app/views/pwa/*渲染动态PWA文件（记得在application.html.erb中链接清单）
  # get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
  # get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker



  # 定义了应用的根路径路由
  root "home#index"

  # 定义了用户资源的路由，仅包括新建和创建用户的操作
  resources :users, only: [:new, :create]

  # 定义了会话资源的路由，包括所有默认操作
  resources :sessions

  namespace :api do
    # 定义了API命名空间下的根路径路由
    get "/news" => "app#news"
    get "/news/:id" => "app#news_detail"
    post "login", to: "authentication#login"

  end

  # 定义命名空间为admin的路由
  namespace :admin do
    # 定义了admin命名空间下的根路径路由
    root "home#index"

    # 定义了banners资源的路由，仅包括新建和创建操作
    resources :banners
    resources :feedbacks
    resources :members
    resources :projects
    resources :questions
    resources :tools
    resources :cmps

    # 定义了用户资源的路由，并添加了搜索操作
    resources :users do
      collection do
        get :search
      end
    end
  end

  get "products/show" => "products#show"


end
